package nowCoder;

import java.util.Scanner;

public class HJ17 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String x = in.nextLine();
        String[] sp = x.split(";");
        int[] index = new int[2];
        for (String m : sp) {
            if (m.length() > 3 || m.length() < 2) continue;
            int[] y = isOk(m);
            index[0] += y[0];
            index[1] += y[1];
        }
        System.out.print(index[0] + "," + index[1]);
    }
    public static int[] isOk(String str){
        int[] x = new int[]{0,0};
        String i = str.substring(1);
        int mm;
        try{
            mm = Integer.parseInt(i);
        }catch(Exception e){
            return x;
        }
        if(str.charAt(0) == 'A') x[0] -= mm;
        if(str.charAt(0) == 'D') x[0] += mm;
        if(str.charAt(0) == 'S') x[1] -= mm;
        if(str.charAt(0) == 'W') x[1] += mm;
        return x;
    }
}
